from django.core.management.base import BaseCommand
from stocksys.tasks_function.serialization_data import serialization_data


class Command(BaseCommand):
    help = 'stock_code_data'
    file_name = 'stock_code_%sdata.csv'

    def handle(self, *args, **options):
        self.stdout.write(self.style.SUCCESS('初始化数据'))
        self.stdout.write(self.style.SUCCESS('载入股票代码数据'))
        data = serialization_data("600000", 2019, 2)
        data.to_csv(self.file_name % 600000, index=False)
        self.stdout.write(self.style.SUCCESS('结束载入'))



